#include <iostream>
#include <ctime>
// [时间][文件:行数] 报错

#define DBG_LEVEL 0
#define INF_LEVEL 1
#define ERR_LEVEL 2
#define DEFUALT_LEVEL DBG_LEVEL
#define LOG(level_str, level, format, ...) {\
    if(level >= DEFUALT_LEVEL){\
        time_t t = time(nullptr);\
        struct tm* ptm = localtime(&t);\
        char buf[32];\
        strftime(buf, 32, "%H:%M:%S",ptm);\
        printf("[%s][%s][%s:%d] " format"\n", #level_str, buf, __FILE__, __LINE__, ##__VA_ARGS__);\
    }\
}
#define DLOG(format, ...) LOG("DEG", DBG_LEVEL, format, ##__VA_ARGS__)
#define ILOG(format, ...) LOG("INF", INF_LEVEL, format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG("ERR", ERR_LEVEL, format, ##__VA_ARGS__)

int main()
{
    // LOG("aaa",DEFUALT_LEVEL,"hello world");
    ELOG("hello world");
    return 0;
}